<?php
  require_once 'header.php';

  if(isset($_POST["aid"]))
  {
    $idAlbum = $_POST["aid"];
  }
  else
  {
    if(isset($_GET["aid"]))
    {
      $idAlbum = $_GET["aid"];
    }
  }

  if(isset($_POST["atitle"]))
  {
    $albumName = $_POST["atitle"];
  }
  else
  {
    if(isset($_GET["atitle"]))
    {
      $albumName = $_GET["atitle"];
    }
  }

  $ConnectDB = new connectDB();
  $SQLList = new sqlList();


  $result = $ConnectDB->buildPreparedStatments($SQLList->SelectAlbum);
  $result->bind_param( 'i', $idAlbum );
  $result->execute();
  $result->bind_result($idPoem, $title);
  $index = 0;
  while ( $rowSet = $result->fetch())
	{
	  $songId[$index] = $idPoem;
	  $songArr[$idPoem] = $title;
	  $index++;
	}
	$result->close();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"[]>
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"
	xml:lang="en">
<head>
<!--
    Created by Artisteer v3.1.0.46558
    Base template (without user's data) checked by http://validator.w3.org : "This page is valid XHTML 1.0 Transitional"
    -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>詩歌-主頁</title>
<link rel="stylesheet" href="style.css" type="text/css" media="screen" />
<!--[if IE 6]><link rel="stylesheet" href="style.ie6.css" type="text/css" media="screen" /><![endif]-->
<!--[if IE 7]><link rel="stylesheet" href="style.ie7.css" type="text/css" media="screen" /><![endif]-->
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="script.js"></script>
<style type="text/css">
.art-post .layout-item-0 {
	margin-top: 13px;
	margin-bottom: 13px;
}

.art-post .layout-item-1 {
	color: #242424;
	background: url(images/e4edc.png) top left no-repeat #FFFFFF;
	padding: 0px;
}

.art-post .layout-item-2 {
	padding: 10px;
}

.ie7 .art-post .art-layout-cell {
	border: none !important;
	padding: 0 !important;
}

.ie6 .art-post .art-layout-cell {
	border: none !important;
	padding: 0 !important;
}
</style>

</head>
<body>
	<div id="art-main">
		<div class="cleared reset-box"></div>
		<div class="art-header">
			<div class="art-header-position">
				<div class="art-header-wrapper">
					<div class="cleared reset-box"></div>
					<div class="art-header-inner">
						<div class="art-headerobject">耶 和 華 是 我 的 力 量 、 是 我 的 盾 牌 ． 我 心 裡 倚 靠 他 、 就 得 幫 助 ． 所 以 我 心 中 歡 樂 ． 我 必 用 詩 歌 頌 讚 他 。(詩 28:7)</div>
						<div class="art-logo">
							<h1 class="art-logo-name">
							</h1>
							<h2 class="art-logo-text">詩 歌 庫</h2>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="cleared reset-box"></div>
		<div class="art-bar art-nav">
			<div class="art-nav-outer">
				<div class="art-nav-wrapper">
					<div class="art-nav-inner">
						<ul class="art-hmenu">
							<li><a href="index.php">主頁</a></li>
							<li><a href="categorylist.php">詩歌分類</a></li>
							<li><a href="albumlist.php" class="active">詩歌專輯</a></li>
							<li><a href="advancedsearch.php">進階搜尋</a></li>
							<li><a href="contactus.php">聯絡我們</a></li>
							<li>
								<div class="search-region">
                  <form action="/poem/song.php" method="get" onsubmit="checkSongId();">
                    <input type="hidden" id="sid" name="sid"/>
                    <input id="autocomplete" size="20" name="query" style="color: rgb(0, 0, 0); ">
                    <input id="searchIcon" type="submit" title="搜尋" value="搜尋">
                  </form>
                </div>
    					</li>
						</ul>
					</div>
				</div>
			</div>
		</div>
		<div class="cleared reset-box"></div>
		<div class="art-box art-sheet">
			<div class="art-box-body art-sheet-body">
				<div class="art-layout-wrapper">
					<div class="art-content-layout">
						<div class="art-content-layout-row">
              <h1><?php print $albumName; ?></h1>
							<div class="songlistContain">
              	<?php
              	if(count($songId)>0)
              	{
              	  print "<ol class=\"songlist\">";
                	foreach ($songId as $id)
                	{
                    print "<li class=\"songlist\"><a href='song.php?sid=" . $id . "'>" . $songArr[$id] . "</a></li>\n";
                  }
                  print "</ol>";
              	}
              	else
              	{
              	  print "<p>此分類沒有詩歌</p>";
              	}
              	?>
              </div>
            </div>
      		</div>
      	</div>
      </div>
    </div>
		<div class="cleared"></div>
		<?php require_once 'footer.php';?>
	</div>
</body>
</html>